const root = {
    value: "A",
    left: {
        value: "B",
        left: {
            value: "D"
        },
        right: {
            value: "E"
        }
    },
    right: {
        value: "C",
        right: {
            value: "F"
        }
    } 
}
// 广度优先算法实现层序遍历
function BFC(root) {
    const queue = [];
    queue.push(root);
    console.log(queue,'--')
    while(queue.length) {
        const top = queue[0];
        console.log(top.value);
        if(top.left) {
            queue.push(top.left)
        }
        if(top.right) {
            queue.push(root.right)
        }
        queue.shift();
    }
}